/*
 * Copyright (C) 2008 aki@akjava.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.akjava.android.openglsamples;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.akjava.android.openglsamples.glut.BoxActivity;
import com.akjava.android.openglsamples.glut.ConeActivity;
import com.akjava.android.openglsamples.glut.CubeActivity;
import com.akjava.android.openglsamples.glut.SphereActivity;
import com.akjava.android.openglsamples.glut.TeapotActivity;
import com.akjava.android.openglsamples.glut.TorusActivity;

public class GLUTDemo extends ListActivity {
	 /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("GLUT Demos");
        
        setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, titles));
        getListView().setTextFilterEnabled(true);
    }
    private String[] titles={
			"Box","Cube","Torus","Sphere","Cone","Teapot"
	};
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);

        Intent i = null;
        if(position==0){
        i=new Intent(this, BoxActivity.class);
        }else if(position==1){
        	 i=new Intent(this, CubeActivity.class);	
        }else if(position==2){
        	 i=new Intent(this, TorusActivity.class);	
        }else if(position==3){
        	 i=new Intent(this, SphereActivity.class);	
        }else if(position==4){
        	 i=new Intent(this, ConeActivity.class);	
        }else if(position==5){
        	 i=new Intent(this, TeapotActivity.class);	
        }
        if(i!=null)
        startActivity(i);
    }
}